package com.jinsp.camera;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;

import com.jinsp.cameralibrary.camera.CameraActivity;
import com.jinsp.cameralibrary.camera.CameraConfigBean;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        int rotation = getWindowManager().getDefaultDisplay().getRotation();
        int widthPixels = getResources().getDisplayMetrics().widthPixels;
        int heightPixels = getResources().getDisplayMetrics().heightPixels;
        Log.e("TAG", "屏幕方向: " + rotation + "  分辨率： " + widthPixels + "x" + heightPixels);

        /*Bitmap bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory().getPath() + "/1.jpg");
        ImageView iv_blur = findViewById(R.id.iv_blur);
        iv_blur.setImageBitmap(BitmapUtils.startBlur(this, bitmap, 25));

        ShapeImageView shapeImageView = findViewById(R.id.shapeImageView);
        shapeImageView.setShape(ShapeImageView.SHAPE_ROUND);
        shapeImageView.isDrawBorder(false);
        shapeImageView.setBorderColor(Color.RED);
        shapeImageView.setImageBitmap(bitmap);*/
    }

    public void onClick(View view) {
        if (view.getId() == R.id.btn_camera) {
            Intent intent = new Intent(this, CameraActivity.class);
            CameraConfigBean cameraConfigBean = new CameraConfigBean.Builder()
                    .setTakePhotoButtonDrawableId(R.drawable.take_photo)
                    .setSwitchCameraDrawableId(R.drawable.camera_switch)
                    .setCameraRatio(CameraConfigBean.CAMERA_RATIO_4_3)
                    .build();
            intent.putExtra(CameraConfigBean.TAG, cameraConfigBean);
            startActivity(intent);
        }
    }
}